package cc.yugu.yhdw.webserver.web.controller.security.hdw;

import cc.yugu.yhdw.common.annotation.ViewModel;
import cc.yugu.yhdw.common.domain.hdw.Agency;
import cc.yugu.yhdw.common.domain.hdw.AgencyInOutMoney;
import cc.yugu.yhdw.common.entity.json.PageResult;
import cc.yugu.yhdw.webserver.entity.SessionUser;
import cc.yugu.yhdw.webserver.service.hdw.AgencyInOutMoneyService;
import cc.yugu.yhdw.webserver.web.controller.security.SecurityController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping(value = "/security/hdw/agency_in_out_money")
public class AgencyInOutMoneyController extends SecurityController {

    @Autowired
    AgencyInOutMoneyService agencyInOutMoneyService;

    @RequestMapping(value = "index.htm")
    public void index() {
    }

    @RequestMapping("page.htm")
    @ViewModel(ViewModel.JSON)
    @ResponseBody
    public PageResult page(AgencyInOutMoney search) {
        return PageResult.successResult(agencyInOutMoneyService.findPage(search));
    }
    /**
     * 新增：首页账户余额信息分页查看
     *
     * @Param: [search]
     * @Return: cc.yugu.yhdw.common.entity.json.PageResult
     * @Author By: zjn 2018/8/31  16:59
     */
    @RequestMapping("pageMoney.htm")
    @ViewModel(ViewModel.JSON)
    @ResponseBody
    public PageResult pageMoney(AgencyInOutMoney search, HttpSession httpSession) {
        SessionUser sessionUser = getSessionUser(httpSession);
        search.setAgencyId(sessionUser.getAgencyId());
        return PageResult.successResult(agencyInOutMoneyService.findPage(search));
    }
}
